import React, { Component } from 'react'
import './CodeLogin.scss'
import img1 from '../../static/qr_guide.png'
import { getCodeImg } from '../../api'
import {connect} from 'react-redux'
class CodeLogin extends Component {

  componentWillMount(){
    getCodeImg().then(({data})=>{
      console.log('****************', data)
    })
  }
  render() {
    const {closeLoginCard} = this.props
    return (
      <div className="CodeLogin">
        <div className="code_title flexBetween">
          <div className="text">登录</div>
          <div className="exit" onClick={closeLoginCard}><span className="iconfont icon-cha"></span></div>
        </div>
        <div className="code_container">
          <img src={img1} alt="" className="examples_img" />
          <div className="con_right">
            <div className="title color333 font18px">网易音乐</div>
            <div className="img_box">
              <img src="" alt="" />
            </div>
            <div className="text font12px">
              使用 <span className="colorblue">网易云音乐APP</span> 扫码登录
            </div>
          </div>
        </div>
      </div>
    )
  }
}
function mapStateToProps(state) {
  return {
    isOpenLoginCard: state.isOpenLoginCard
  }
}
function mapDispatchToProps(dispatch) {
  return {
    closeLoginCard(){
      console.log('sss')
      dispatch({
        type:'CLOSELOGINCARD'
      })
    }
  }
}
export default connect(mapStateToProps,mapDispatchToProps)(CodeLogin)